libxc: convert flask interfaces over to hypercall buffers
authorIan Campbell <ian.campbell@citrix.com>
Fri, 22 Oct 2010 14:14:51 +0000 (15:14 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 22 Oct 2010 14:14:51 +0000 (15:14 +0100)
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
tools/libxc/xc_flask.c

index 621967f4962d5ccab5d7635caef1bf439ec21a7b..27794a82d59318ceb24caace444c6fa4337b2e8a 100644 (file)
@@ -40,23 +40,24 @@ int xc_flask_op(xc_interface *xch, flask_op_t *op)
 {
     int ret = -1;
     DECLARE_HYPERCALL;
+    DECLARE_HYPERCALL_BOUNCE(op, sizeof(*op), XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
 
-    hypercall.op     = __HYPERVISOR_xsm_op;
-    hypercall.arg[0] = (unsigned long)op;
-
-    if ( lock_pages(xch, op, sizeof(*op)) != 0 )
+    if ( xc_hypercall_bounce_pre(xch, op) )
     {
-        PERROR("Could not lock memory for Xen hypercall");
+        PERROR("Could not bounce memory for flask op hypercall");
         goto out;
     }
 
+    hypercall.op     = __HYPERVISOR_xsm_op;
+    hypercall.arg[0] = HYPERCALL_BUFFER_AS_ARG(op);
+
     if ( (ret = do_xen_hypercall(xch, &hypercall)) < 0 )
     {
         if ( errno == EACCES )
             fprintf(stderr, "XSM operation failed!\n");
     }
 
-    unlock_pages(xch, op, sizeof(*op));
+    xc_hypercall_bounce_post(xch, op);
 
  out:
     return ret;